\hypertarget{fence_8nxc}{
\section{workspace/WR/Source/fence.nxc File Reference}
\label{fence_8nxc}\index{workspace/WR/Source/fence.nxc@{workspace/WR/Source/fence.nxc}}
}


A program used for riding close to the band.  


{\ttfamily \#include \char`\"{}utils.h\char`\"{}}\par
{\ttfamily \#include \char`\"{}communication.h\char`\"{}}\par
{\ttfamily \#include \char`\"{}move.h\char`\"{}}\par
{\ttfamily \#include \char`\"{}pid.h\char`\"{}}\par
\subsection*{Defines}
\begin{DoxyCompactItemize}
\item 
\hypertarget{fence_8nxc_a738b9657b067e383cd066d4c7ca6f576}{
\#define \hyperlink{fence_8nxc_a738b9657b067e383cd066d4c7ca6f576}{CPWR\_\-B}~60}
\label{fence_8nxc_a738b9657b067e383cd066d4c7ca6f576}

\begin{DoxyCompactList}\small\item\em Base speed of robot. \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_ae382ea7d9a3437076c5616056836377a}{
\#define \hyperlink{fence_8nxc_ae382ea7d9a3437076c5616056836377a}{CPWR\_\-S}~40}
\label{fence_8nxc_ae382ea7d9a3437076c5616056836377a}

\begin{DoxyCompactList}\small\item\em Slow speed of robot. \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_a542a0090a7c37b6404cf8ba31d59f57d}{
\#define \hyperlink{fence_8nxc_a542a0090a7c37b6404cf8ba31d59f57d}{PWR\_\-T}~10}
\label{fence_8nxc_a542a0090a7c37b6404cf8ba31d59f57d}

\begin{DoxyCompactList}\small\item\em PID settings. Used for calculating maximum pid correction. \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_a211c307420126f39f228195cf77ae83c}{
\#define \hyperlink{fence_8nxc_a211c307420126f39f228195cf77ae83c}{PID\_\-REF}~10}
\label{fence_8nxc_a211c307420126f39f228195cf77ae83c}

\begin{DoxyCompactList}\small\item\em PID settings. Correct ultrasonic distance from the fence, reference for PID. \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_a2ded3bab320b6ac387798d39189fb505}{
\#define \hyperlink{fence_8nxc_a2ded3bab320b6ac387798d39189fb505}{PID\_\-MAX}~50}
\label{fence_8nxc_a2ded3bab320b6ac387798d39189fb505}

\begin{DoxyCompactList}\small\item\em PID settings. Used for calculating maximum pid correction. \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_ac9341f36c8b85c8d70f06973c2d9a5bd}{
\#define \hyperlink{fence_8nxc_ac9341f36c8b85c8d70f06973c2d9a5bd}{FRONT\_\-MIN}~29}
\label{fence_8nxc_ac9341f36c8b85c8d70f06973c2d9a5bd}

\begin{DoxyCompactList}\small\item\em Front light settings. Minimal front light distance from fence for safe operating. \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_acb1164349a1fa4b7052e28f7c7c735d4}{
\#define \hyperlink{fence_8nxc_acb1164349a1fa4b7052e28f7c7c735d4}{FFRONTAL\_\-REVT}~300}
\label{fence_8nxc_acb1164349a1fa4b7052e28f7c7c735d4}

\begin{DoxyCompactList}\small\item\em Bumper settings. Rev time if full frontal crash. \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_abda398fa4722b8691dc8c52c733a2814}{
\#define \hyperlink{fence_8nxc_abda398fa4722b8691dc8c52c733a2814}{FFRONTAL\_\-RANGLE}~70}
\label{fence_8nxc_abda398fa4722b8691dc8c52c733a2814}

\begin{DoxyCompactList}\small\item\em Bumper settings. Angle (in degrees) to turn if side right frontal crash. \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_aac0491bc7a39228e57b85de235ef59eb}{
\#define \hyperlink{fence_8nxc_aac0491bc7a39228e57b85de235ef59eb}{LFRONTAL\_\-REVT}~300}
\label{fence_8nxc_aac0491bc7a39228e57b85de235ef59eb}

\begin{DoxyCompactList}\small\item\em Bumper settings. Rev time if side left frontal crash. \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_ad19631fb45582ad9441719c376c07c3b}{
\#define \hyperlink{fence_8nxc_ad19631fb45582ad9441719c376c07c3b}{LFRONTAL\_\-RANGLE}~60}
\label{fence_8nxc_ad19631fb45582ad9441719c376c07c3b}

\begin{DoxyCompactList}\small\item\em Bumper settings. Angle (in degrees) to turn if side left frontal crash. \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_a623033e48068d57555d513a2d56d0c40}{
\#define \hyperlink{fence_8nxc_a623033e48068d57555d513a2d56d0c40}{RFRONTAL\_\-REVT}~300}
\label{fence_8nxc_a623033e48068d57555d513a2d56d0c40}

\begin{DoxyCompactList}\small\item\em Bumper settings. Rev time if side right frontal crash. \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_a70438bca69ec65d9a29a9f120922464d}{
\#define \hyperlink{fence_8nxc_a70438bca69ec65d9a29a9f120922464d}{RFRONTAL\_\-RANGLE}~80}
\label{fence_8nxc_a70438bca69ec65d9a29a9f120922464d}

\begin{DoxyCompactList}\small\item\em Bumper settings. Angle (in degrees) to turn if side right frontal crash. \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_a7861c2174f24a87c43840f87f3cf8a14}{
\#define \hyperlink{fence_8nxc_a7861c2174f24a87c43840f87f3cf8a14}{FRONT\_\-TT}~100}
\label{fence_8nxc_a7861c2174f24a87c43840f87f3cf8a14}

\begin{DoxyCompactList}\small\item\em Turn time if danger ahead. \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_ab9d3d1049b45438591608c99774c5cba}{
\#define \hyperlink{fence_8nxc_ab9d3d1049b45438591608c99774c5cba}{LIGHTFRPORT}~IN\_\-2}
\label{fence_8nxc_ab9d3d1049b45438591608c99774c5cba}

\begin{DoxyCompactList}\small\item\em Front light port. \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_a73b327cc697b593b06f47bc6915ba9cf}{
\#define \hyperlink{fence_8nxc_a73b327cc697b593b06f47bc6915ba9cf}{SONSIDEPORT}~IN\_\-1}
\label{fence_8nxc_a73b327cc697b593b06f47bc6915ba9cf}

\begin{DoxyCompactList}\small\item\em Side ultrasonic sensor port. \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_a867a2479cd5e144bc98b3e24bd48a79c}{
\#define \hyperlink{fence_8nxc_a867a2479cd5e144bc98b3e24bd48a79c}{TOUCHLPORT}~IN\_\-4}
\label{fence_8nxc_a867a2479cd5e144bc98b3e24bd48a79c}

\begin{DoxyCompactList}\small\item\em Left touch sensor port ( Bumper ). \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_ac16330478e7b003e00f37e90e0c5bdf6}{
\#define \hyperlink{fence_8nxc_ac16330478e7b003e00f37e90e0c5bdf6}{TOUCHRPORT}~IN\_\-3}
\label{fence_8nxc_ac16330478e7b003e00f37e90e0c5bdf6}

\begin{DoxyCompactList}\small\item\em Right touch sensor port ( Bumper ). \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_a26fd581a2d8a8f58a30535495c8d0843}{
\#define \hyperlink{fence_8nxc_a26fd581a2d8a8f58a30535495c8d0843}{LIGHTFR}~Sensor(LIGHTFRPORT)}
\label{fence_8nxc_a26fd581a2d8a8f58a30535495c8d0843}

\begin{DoxyCompactList}\small\item\em Initialize Front light port. \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_aec1d71dea61f39acce761840c4ce0d27}{
\#define \hyperlink{fence_8nxc_aec1d71dea61f39acce761840c4ce0d27}{SONSIDE}~SensorUS(SONSIDEPORT)}
\label{fence_8nxc_aec1d71dea61f39acce761840c4ce0d27}

\begin{DoxyCompactList}\small\item\em Initialize side ultrasonic sensor port. \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_a98c4f75c182ff1c7c6f3fb288f4f3857}{
\#define \hyperlink{fence_8nxc_a98c4f75c182ff1c7c6f3fb288f4f3857}{TOUCHL}~Sensor(TOUCHLPORT)}
\label{fence_8nxc_a98c4f75c182ff1c7c6f3fb288f4f3857}

\begin{DoxyCompactList}\small\item\em Initialize left touch sensor port ( Bumper ). \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_a6537370af17fd38a56bcf670d8db23e3}{
\#define \hyperlink{fence_8nxc_a6537370af17fd38a56bcf670d8db23e3}{TOUCHR}~Sensor(TOUCHRPORT)}
\label{fence_8nxc_a6537370af17fd38a56bcf670d8db23e3}

\begin{DoxyCompactList}\small\item\em Initialize right touch sensor port ( Bumper ). \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_a8ccbe4f289c6182e18589c6f2c6108ee}{
\#define \hyperlink{fence_8nxc_a8ccbe4f289c6182e18589c6f2c6108ee}{ST\_\-STOP}~0}
\label{fence_8nxc_a8ccbe4f289c6182e18589c6f2c6108ee}

\begin{DoxyCompactList}\small\item\em States. Stop -\/ no movement. \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_abba849981e74e84eb3836d3c03c363a9}{
\#define \hyperlink{fence_8nxc_abba849981e74e84eb3836d3c03c363a9}{ST\_\-FWD}~1}
\label{fence_8nxc_abba849981e74e84eb3836d3c03c363a9}

\begin{DoxyCompactList}\small\item\em States. Move forward (basic speed). \item\end{DoxyCompactList}\item 
\hypertarget{fence_8nxc_a82671cbfd87d61e73ed46e39a25ea515}{
\#define \hyperlink{fence_8nxc_a82671cbfd87d61e73ed46e39a25ea515}{ST\_\-FRONTT}~6}
\label{fence_8nxc_a82671cbfd87d61e73ed46e39a25ea515}

\begin{DoxyCompactList}\small\item\em States. Danger is ahead -\/ turn. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{fence_8nxc_a9a2af8e2cd81255d3bf384db4a382807}{
task {\bfseries main} ()}
\label{fence_8nxc_a9a2af8e2cd81255d3bf384db4a382807}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
A program used for riding close to the band. 